#include "kernel/syspub.h"
#include "ctype.h"


void XipHexToAsc(unsigned char dat, unsigned char **new)
{
    unsigned char tdat;
    unsigned char ascii_table[16] = {
      '0', '1', '2', '3', '4', '5', '6', '7',
      '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
    };

    if (islower(dat)) tdat = dat;
    else              tdat = toupper(dat);

    **new = ascii_table[toupper(tdat) >> 4];
    *new += 1;
    **new = ascii_table[toupper(tdat) & 0x0f];
    *new += 1;
}

void XipHexToStr(unsigned char *read, unsigned char **write, int len)
{
    while(len--)
      XipHexToAsc(*read++, write);
}

